/**
 * @class Window 基于Dialog的应用窗口类，内容中预置了iframe用于打开链接
 */
define('core/panel/Window', ['jQuery', 'core/panel/Dialog'], function( require ){
	var $ = require('jQuery'),
		Dialog = require('core/panel/Dialog'),
		mix = K.mix,
		extend = K.extend;

	var KWindow = extend(function( opts ){
		this._initWindow( opts );
	},Dialog);

	mix( KWindow.prototype, {
		_initWindow: function( opts ){
			KWindow.$super.call( this, opts );
			this.setUrl( this.url );
		},
		open: function( url ){
			this.setUrl( url );
			this.show();
		},
		setUrl: function( url ){
			this.url = url || this.url;
			if( this.url )
			this.setContent(
				$('<iframe src="' + this.url + '" width="100%" height="100%" frameborder="no" scrolling="no"/>')
			);
		}
	});

	//静态方法
	mix( KWindow, {
		/**
		 * 在Dialog中打开一个新的页面
		 * @static
		 * @param {String}	url			页面URL
		 * @param {Integer}	width		窗口宽度
		 * @param {Integer} height		窗口高度
		 * @param {String}	title		窗口标题
		 * @param {String}	className	窗口样式(默认使用Dialog的默认值:panel-t1)
		 * @return {Dialog}
		 */
		open: function( url, width, height, title, className ){
			var win = new KWindow({
				url: url,
				width: width,
				height: height,
				title: title,
				className: className||'panel-t1'
			});
			win.show();
			return win;
		}
	});

	return KWindow;
});
